<?php
/**

 //  The DoYouHaoBaby PHP FrameWork - form
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //	 | (C) 2010 - 2011 http://doyouhaobaby.net All rights reserved.
 //	 | This is not a free software, use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //	 | form Form模型
 //  +---------------------------------------------------------------------

*/

!defined('DYHB_PATH') && exit;

class FormModel extends Model{


	/**
     * 返回对象的定义
     */
    static public function init__(){

        return array(

            'table_name' => 'form',

            'props' => array(

                // 主键应该是只读，确保领域对象的“不变量”
                'form_id' => array( 'readonly' => true ),
            ),

            'attr_protected' => 'form_id',

            'autofill' => array(

				array( 'status','1','CREATE' ), 
                array( 'create_date','time','CREATE','function' ),
                array( 'update_date','time','CREATE','function' )
            ),

            'check' => array(

                 'form_title'=>array(
				      
				     array( 'require','标题必须！' ),
				 ),

				 'form_email'=>array(
					 
				     array('empty'),
				     array( 'email','邮箱格式错误！' ), 
				 ),
                 
			     'form_content'=>array(
				      
				     array( 'require','内容必须！' ),
				 ),
            ),

        );

    }


	/**
     * 开启一个查询，查找符合条件的对象或对象集合
     *
     * @static
     * @return DbSelect
     */
    static function F( ){

        $arrArgs = func_get_args();
        return ModelMeta::instance( __CLASS__ )->findByArgs( $arrArgs );
    }


    /**
     * 返回当前 Model 类的元数据对象
     *
     * @static
     * @return ModelMeta
     */
    static function M( ){

        return ModelMeta::instance(__CLASS__);
    }

}
